home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / valimp.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  3.8 KB  |  110 lines

  1. #ifndef __VALIMP_CC
  2. #define __VALIMP_CC
  3. #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
  4.  
  5. /***************************************************************************
  6.  *
  7.  * valimp.cc - Declarations for the Standard Library valarray
  8.  *
  9.  * $Id: valimp.cc,v 1.1 1996/09/25 00:47:56 philippe Exp $
  10.  *
  11.  ***************************************************************************
  12.  *
  13.  * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
  14.  * ALL RIGHTS RESERVED *
  15.  * The software and information contained herein are proprietary to, and
  16.  * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
  17.  * intends to preserve as trade secrets such software and information.
  18.  * This software is furnished pursuant to a written license agreement and
  19.  * may be used, copied, transmitted, and stored only in accordance with
  20.  * the terms of such license and with the inclusion of the above copyright
  21.  * notice.  This software and information or any other copies thereof may
  22.  * not be provided or otherwise made available to any other person.
  23.  *
  24.  * Notwithstanding any other lease or license that may pertain to, or
  25.  * accompany the delivery of, this computer software and information, the
  26.  * rights of the Government regarding its use, reproduction and disclosure
  27.  * are as set forth in Section 52.227-19 of the FARS Computer
  28.  * Software-Restricted Rights clause.
  29.  *
  30.  * Use, duplication, or disclosure by the Government is subject to
  31.  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  32.  * Technical Data and Computer Software clause at DFARS 252.227-7013.
  33.  * Contractor/Manufacturer is Rogue Wave Software, Inc.,
  34.  * P.O. Box 2328, Corvallis, Oregon 97339.
  35.  *
  36.  * This computer software and information is distributed with "restricted
  37.  * rights."  Use, duplication or disclosure is subject to restrictions as
  38.  * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
  39.  * Computer Software-Restricted Rights (April 1985)."  If the Clause at
  40.  * 18-52.227-74 "Rights in Data General" is specified in the contract,
  41.  * then the "Alternate III" clause applies.
  42.  *
  43.  **************************************************************************/
  44.  
  45. #ifndef _RWSTD_NO_NAMESPACE
  46.  #ifndef _RWSTD_NO_IMP_NAMESPACE
  47.   namespace rwstd {
  48.  #else
  49.   namespace std {
  50.  #endif
  51. #endif
  52.  
  53.  
  54. /*****************************************************************
  55. *                                                                *
  56. *                _RW_array<T> MEMBER FUNCTIONS                    *
  57. *                                                                *
  58. ******************************************************************/
  59.  
  60.   template <class T>
  61.   void
  62.   _RW_array<T>::_initialize_with_value(const T& value, size_t size)
  63.   {
  64.       if ( _RW_length < size )
  65.         _RW_resize_without_copy(size);
  66.  
  67.       for(size_t cpt=0; cpt<size; cpt++)
  68.        _RW_storage[cpt] = value;
  69.   }
  70.  
  71.    template <class T>
  72.    void
  73.    _RW_array<T>::_initialize_with_array(const T* pointer, size_t size)
  74.    {
  75.       if ( _RW_length < size )
  76.         _RW_resize_without_copy(size);
  77.  
  78.       if ( valarray_traits_optimize<T>::optimize_copy() )
  79.        memcpy((void *)_RW_storage,(void*)pointer,size*sizeof(T));
  80.       else
  81.       {
  82.         for(size_t cpt=0; cpt<size; cpt++)
  83.          _RW_storage[cpt] = pointer[cpt];
  84.       }
  85.     }
  86.  
  87.    template <class T>
  88.    void 
  89.    _RW_array<T>::_copy_memory_array(const _RW_array<T>& array)
  90.    {
  91.       if ( array._get_length() != _RW_length )
  92.        _RW_resize_without_copy(array._get_length());
  93.  
  94.       if ( valarray_traits_optimize<T>::optimize_copy() )
  95.        array._RW_copy(_RW_storage);
  96.       else
  97.       {
  98.         for(size_t tmp=0; tmp<_RW_length; tmp++)
  99.          _RW_storage[tmp]= array[tmp];
  100.       }
  101.     }
  102.  
  103.  
  104. #ifndef _RWSTD_NO_NAMESPACE
  105. }
  106. #endif
  107.  
  108. #pragma option pop
  109. #endif /* __VALIMP_CC */
  110.